import {getCybercafes, getCybercafesDetail, editCybercafesDetail, 
    addCybercafesDetail, deleteCybercafesDetail, countCybercafe, faultAnalysis, 
    onlineHistoricRecords, pingHistoricRecords, getCitys, templateFileDownload, tracerouteResults, deleteTracerouteResults, previewTracerouteResults} from '@/api/homeApi'
const home = {
    namespaced: true,
    state: {
    },
    getters: {},
    mutations: {
    },
    actions: {
        // 获取列表详情
        GetCybercafes ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                getCybercafes(params).then(res => {
                    resolve(res)
                }).catch(error => {
                    reject(error)
                })
            })
        },
        // 获取网吧详情
        GetCybercafesDetail ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                getCybercafesDetail(params).then(res => {
                    resolve(res)
                })
            })
        },
        // 编辑网吧信息
        EditCybercafesDetail ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                editCybercafesDetail(params).then(res => {
                    resolve(res)
                })
            })
        },
        // 新增网吧信息
        AddCybercafesDetail ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                addCybercafesDetail(params).then(res => {
                    resolve(res)
                })
            })
        },
        // 删除网吧信息
        DeleteCybercafesDetail ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                deleteCybercafesDetail(params).then(res => {
                    resolve(res)
                })
            })
        },
        // 删除网吧信息
        CountCybercafe ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                countCybercafe(params).then(res => {
                    resolve(res)
                })
            })
        },
        // 删除网吧信息
        FaultAnalysis ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                faultAnalysis(params).then(res => {
                    resolve(res)
                })
            })
        },
        // 在线情况历史记录
        OnlineHistoricRecords ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                onlineHistoricRecords(params).then(res => {
                    resolve(res)
                })
            })
        },
        // ping历史记录
        PingHistoricRecords ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                pingHistoricRecords(params).then(res => {
                    resolve(res)
                })
            })
        },
        // 获取省市信息
        GetCitys ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                getCitys(params).then(res => {
                    // console.log(res)
                    resolve(res)
                })
            })
        },
        TemplateFileDownload ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                templateFileDownload(params).then(res => {
                    resolve(res)
                })
            })
        },   
        // 路由记录
        TracerouteResults ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                tracerouteResults(params).then(res => {
                    resolve(res)
                })
            })
        },
        // 删除路由记录
        DeleteTracerouteResults ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                deleteTracerouteResults(params).then(res => {
                    resolve(res)
                })
            })
        },
        // 预览路由记录
        PreviewTracerouteResults ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                previewTracerouteResults(params).then(res => {
                    resolve(res)
                })
            })
        }
    }
}
export default home
